//查询所有总类别
axios.post(allTypeListApi, {}).then(res => {
    let list = document.querySelector('.list')
    console.log(res.data.info);
    let html = res.data.info.map(v => `
    <li><a href="#">${v.typeName}</a></li>
    `).join('');
    list.innerHTML += html;
})

//查询所有课程类型
axios.post(allCourseTypeListApi, {}).then(res => {
    let box = document.querySelector('.box')
    console.log(res.data.info);
    let html = res.data.info.map(v => `
    <dl>
        <dt><a href="#"><img src="img/小图.jpg" alt=""></a></dt>
        <dd>${v.courseTypeName}</dd>
    </dl>
    `).join('');
    box.innerHTML = html + `<dl>
    <dt><a href="#"><img src="img/小图标5.jpg" alt=""></a></dt>
        <dd>名师讲堂</dd>
    </dl>`

    $('.box dl').eq(0).click(function() {
        location.href = 'Single.html';
    })
    $('.box dl').eq(1).click(function() {
        location.href = 'many.html';
    })
    $('.box dl').eq(2).click(function() {
        location.href = 'private.html';
    })
    $('.box dl').eq(3).click(function() {
        location.href = 'live.html';
    })
    $('.box dl').eq(4).click(function() {
        location.href = 'teacher.html';
    })
})

// 一听就懂
axios.post(VideoCourseApi, {}).then(res => {
    let listen = document.querySelector('.listen')
    console.log(res.data.info);
    let html = `
    <div style="color: #fff; width:7rem;height: 0.8rem;margin: 0 auto;display: flex;justify-content: space-between;align-items: center;">
        <dl>
            <dt style="font-size: 0.32rem;">${res.data.info.videoCourseName}</dt>
            <dd>${res.data.info.videoTitle}</dd>
        </dl>
        <a href="special.html" style="color: #fff;">进入专栏></a>
    </div>
    <div style="width: 7rem;height:1.6rem;background: #fff;margin: 0.1rem auto;display: flex;">
        <a href="#" style="display: inline-block;margin:0.07rem 0.1rem;"><img style="width:100%;height:100%" src="${res.data.info.videoCourseImgUrl}" alt=""></a>
        <div>
            <div style="display: flex;flex-direction: column;width: 6rem;height: 0.8rem;margin-top: 0.1rem;">
                <a href="#" style="color: black">
                    <p>085/365《巴黎圣母院》一起怀念美丽的哥特...</p>
                </a>
                <span>导师：齐孝静</span>
            </div>
            <div style="display: flex;flex-direction: column;">
                <span style="color: #EEC14F">已有${res.data.info.watchNumber}人听过</span>
                <span>时长：07：10</span>
            </div>
        </div>
    </div>
    `
    listen.innerHTML += html;
})

axios.post(todayRecommendApi, {}).then(res => {
    let tuijian = document.querySelector('.tuijian')
    console.log(res.data.info);
    let html = `
    <article class="picture">
        <div class="block">
            <div>
                <img style="width: 100%;height:100%" src="${res.data.info.videoCourseImgUrl}" alt="">
            </div>
            <div>
                <div>
                    <p>${res.data.info.videoCourseName}</p>
                    <p style="color: #aaa;">${res.data.info.videoInfo}</p>
                </div>
                <div>
                    <span>导师：秦潇</span>
                    <span style="color: #EEC14F; ">${res.data.info.watchNumber}人已购</span>
                </div>
            </div>
        </div>
    </article>
    `
    tuijian.innerHTML = html;
})